package com.dk.hi.core.helper;

import java.util.Random;

/**
 * Random generator
 */
public class RandomHelper {
	/**
	 * @param max
	 *            - the random max
	 * @return a random number between 0 and max
	 */
	public static final int getRandom(int max) {
		Random r = new Random();
		return r.nextInt(max);
	}

	/**
	 * @param mod
	 * @return a random number between -mod and +mod
	 */
	public static final int getRandomMod(int mod) {
		Random r = new Random();
		return r.nextInt(mod * 2) - mod;
	}

	/**
	 * @return 1 or -1, randomly
	 */
	public static final int getRandSign() {
		Random r = new Random();
		return (r.nextBoolean()) ? 1 : -1;
	}
}
